package com.shijun.im.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.shijun.im.listener.OnInternetChangeListener;

/**
 * Created by zhushijun on 2017/9/22 0022.
 */

public abstract class BaseActivity extends AppCompatActivity implements OnInternetChangeListener {
    protected Context context;
    protected Activity activity;
    @Override
    public void onInternetChange(int state) {
        if(state == OnInternetChangeListener.INTERNET_2G);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this;
        activity = this;
        setContentView(loadLayout());
        initLayout(savedInstanceState);
    }

    /**
     * 加载页面布局
     */
    protected abstract int loadLayout();

    /**
     * 初始化布局及其他操作
     */
    protected abstract void initLayout(Bundle savedInstanceState);

    /**
     * 返回状态栏颜色
     */
    protected abstract int setStatusBarColor();

    /**
     * 返回状态栏字体是否着色
     */
    protected abstract boolean isSettingStatusBarText();

    /**
     * 得到控件的方法
     */
    protected <T extends View> T findTById(int resId) {
        return (T) findViewById(resId);
    }

}
